library("dplyr",lib.loc="~/myOwnRPackage")

argv<-commandArgs(TRUE)

#run: Rscript --slave sample_N.R request_Stat/hasCmt.res N sampled.res 

hasCmtRequest_fin<-argv[1]
sampleSize<-as.numeric(argv[2])
sampled_fout<-argv[3]

t<-read.table(hasCmtRequest_fin,head=F,sep=",")
names(t)<-c("id","cmtCnt")
t2<-sample_n(t,sampleSize)
write.table(t2,file=sampled_fout,sep=",",col.names=T,row.names=F)
